package com.zdy.controller;

import com.zdy.entity.Student;
import com.zdy.entity.Teacher;
import com.zdy.mapper.datasource01.TeacherMapper;
import com.zdy.mapper.datasource02.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.List;

/**
 * @Author: Deyou
 * @Date: 2021/4/14
 */
@EnableSwagger2
@RestController
public class TestController {
    @Autowired
    private TeacherMapper teacherMapper;
    @Autowired
    private StudentMapper studentMapper;

    /***
     * 查询所有教师
     *
     */
    @GetMapping("/findAllTeacher")
    public List<Teacher> findAllTeacher(){
        List<Teacher> teachers = teacherMapper.findAll();
        return teachers;
    }
    /***
     * 查询所有学生
     */
    @GetMapping("/findAllStudent")
    public List<Student> findAllStudent(){
        List<Student> studnets = studentMapper.findAll();
        return studnets;
    }
}
